package com.lancoo.cvas.entity;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import com.lancoo.cvas.arrangecourse.entities.ClassHour;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 课表
 * 
 * @author liufeng
 * @email 1037383243@qq.com
 * @date 2023-12-04 11:54:00
 */
@Data
@TableName("schedule")
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@ApiModel("课表信息")
public class Schedule implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 课表
	 */
	@TableId(value = "id", type = IdType.AUTO)
	@ApiModelProperty("id")
	private Long id;
	/**
	 * 任务id
	 */
	@ApiModelProperty("任务id")
	private Integer taskId;
	/**
	 * 教学班id
	 */
	@ApiModelProperty("教学班id")
	private Long teachingClassId;
	/**
	 * 教学班名称
	 */
	@ApiModelProperty("教学班名称")
	private String teachingClassName;
	/**
	 * 课程id
	 */
	@ApiModelProperty("课程id")
	private Long courseId;
	/**
	 * 课程名称
	 */
	@ApiModelProperty("课程名称")
	private String courseName;
	/**
	 * 
	 */
	@ApiModelProperty("教室id")
	private Long roomId;
	/**
	 * timeCode为null时，代表调课模式下处于暂放区
	 */
	@ApiModelProperty("课时编码")
	private String timeCode;


	@ApiModelProperty("课时分组")
	private String timeGroup;
	/**
	 * 双课节timecode
	 */
	@ApiModelProperty("双课节timecode")
	private String doubleTimeCode;
	/**
	 * 拆班教学班id
	 */
	@ApiModelProperty("拆班教学班id")
	private Integer subTeachingClassId;
	/**
	 * 课表所属类型 0:环节  1讲授 2实验 3上机 4其他
	 */
	@ApiModelProperty("授课类型")
	private Integer hourType;
	/**
	 * 连上节次
	 */
	@ApiModelProperty("连上节次")
	private Integer connectSection;
	/**
	 * 
	 */
	@ApiModelProperty("周次")
	private String week;
	/**
	 * 0：未锁定课表；1：导入的课表；2：锁定的课表
	 */
	@ApiModelProperty("类别")
	private Integer flag;
	/**
	 * 删除标识：
0：未删除
1：删除
	 */
	@ApiModelProperty("删除标识")
	private Integer deleted;
	/**
	 * 
	 */
	private String reserve;

	@TableField(exist = false)
	@ApiModelProperty("教室类型")
	private Integer roomType;

	public Schedule(ClassHour cloneable) {
		this.taskId = cloneable.getCourseUnit().getTaskId();
		this.teachingClassId = cloneable.getCourseUnit().getTeachingClassId();
		this.teachingClassName = cloneable.getCourseUnit().getTeachingClassName();
		this.courseId = cloneable.getCourseUnit().getCourseId();
		this.courseName = cloneable.getCourseUnit().getCourseName();
		this.subTeachingClassId = cloneable.getCourseUnit().getSubTeachingClassId();
		this.hourType = cloneable.getCourseUnit().getTeachingType();
		this.connectSection = cloneable.getCourseUnit().getConnectSection();
		this.flag = cloneable.getCourseUnit().getTeachingClassType();
		this.week = cloneable.getCourseUnit().getClassWeeks();
		this.timeGroup = cloneable.getCourseUnit().getTimeGroup();
		if (cloneable.getTimeslotRoom() != null) {
			this.roomId = cloneable.getTimeslotRoom().getRoomId();
			this.timeCode = cloneable.getTimeslotRoom().getTimeslotCode();
		}else {

				String weekRoomId = cloneable.getCourseUnit().getRoomId();
				if (StrUtil.isNotEmpty(weekRoomId)){
					this.roomId = Long.valueOf(weekRoomId);
				}

		}
	}

}
